/*
 * @lc app=leetcode.cn id=506 lang=typescript
 *
 * [506] 相对名次
 */

// @lc code=start
function findRelativeRanks(score: number[]): string[] {
    const sorted = [...score].sort((a, b) => b - a);
    return score.map((i) => {
        const index = sorted.indexOf(i);

        switch (index) {
            case 0:
                return "Gold Medal";
            case 1:
                return "Silver Medal";
            case 2:
                return "Bronze Medal";
        }
        return (index + 1).toString();
    });
}
// @lc code=end
